package com.heima.feigns;
import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.UserFeignFallback;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.pojos.ApUser;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(value = "leadnews-user", // 调用服务
        fallbackFactory = UserFeignFallback.class, // 服务降级
        configuration = HeimaFeignAutoConfiguration.class) // feign日志配置
public interface UserFeign {
    @GetMapping("/api/v1/user/{id}")
    ResponseResult<ApUser> findUserById(@PathVariable(value="id") Integer id);

    @PostMapping("/api/v1/user/fans_list")
    public ResponseResult<List<ApUser>> loadList(@RequestParam(value = "apUserId") Integer apUserId);

    /**
     * 改变用户状态
     *
     * @param id
     * @param state
     * @return
     */
    @GetMapping("/api/v1/user/change")
    public ResponseResult changeState(
            @RequestParam(value = "id") Integer id,
            @RequestParam(value = "state") Boolean state
    );
}